<template xmlns="http://www.w3.org/1999/html">
  <sea-data-table ref="tableObject" url="/sys/msg/props/list" :auto-load="false" :is-page="false">
    <!--表头-->
    <sea-table-header slot="header" :display-form="false">
      <!--标题栏-->
      <sea-table-title slot="title" title="消息参数配置" subtitle="因为需要代码配合，此功能一般只开放给开发人员。"></sea-table-title>

      <!--按钮栏-->
      <template slot="buttons">
        <el-button plain size="small" title="新增" icon="fa fa-plus" @click="onAction('new')"></el-button>
      </template>
    </sea-table-header>

    <!--表头-->
    <template slot="columns">
      <sea-col-input property="name" label="字段名" width="160"></sea-col-input>
      <sea-col-input property="label" label="字段标签" width="160"></sea-col-input>
      <sea-col-switch property="require" label="是否必填" width="120" :change="onAction"></sea-col-switch>
      <sea-col-input property="length" label="字段长度" width="120"></sea-col-input>
      <sea-col-input property="value" label="测试值"></sea-col-input>
    </template>
  </sea-data-table>
</template>

<script>
export default {
    components: {}
    , props: {
        // 作业ID
        guid: {type: String, default: undefined}
    }
    , watch: {
        guid: {
            handler: function (val) {
                let params = {msgId: val};
                this.reload(params);
            }
        }
    }
    , methods: {
        /**
         * 操作成功回调
         */
        reload: function (val) {
            this.$refs.tableObject.reload(val);
        }

        /**
         * 操作栏事件分发
         * @param evt 事件
         * @param row 行级对象
         * @param old 可供回滚的参数
         */
        , onAction: function (evt, row, old) {

        }
    }
}
</script>
